package com.server.projectiles;

import java.rmi.RemoteException;

import gnu.cajo.invoke.Remote;

import combat.protocol.data.PhysicalObject;
import combat.protocol.data.DoublePoint;
import combat.protocol.interfaces.ProjectileInt;
import combat.protocol.types.ProjectileType;

public class projectileImpl extends PhysicalObject implements ProjectileInt {
	private static final long serialVersionUID = 1L;
	
	public DoublePoint source;
	public Object target;
	public double maxDistance;
	public ProjectileType projectileType;
	
	public projectileImpl(DoublePoint source, Object target, double maxDistance, ProjectileType type) {
	    this.source = source;
	    this.maxDistance = maxDistance;
	    this.target = target;
	    this.projectileType = type;
	}

	public DoublePoint getSource() {
		return this.source;
	}

	public void setSource(DoublePoint source) {
		this.source = source;
	}

	public void setTarget(DoublePoint target) {
		this.target = target;
	}

	public double getMaxDistance() {
		return this.maxDistance;
	}

	public void setMaxDistance(double maxDistance) {
		this.maxDistance = maxDistance;
	}

	public ProjectileType getProjectileType() {
		return this.projectileType;
	}

	public void setProjectileType(ProjectileType projectileType) {
		this.projectileType = projectileType;
	}

	public void setTarget(Object target) {
		this.target = (DoublePoint)target;
	}

	public Remote getTarget_Remote() {
		try {
			return new Remote(getTarget());
		} catch (RemoteException e) {
			System.out.println("ERROR: Update getTarget function failed");
		}
		return null;
	}

	public Object getTarget() {
		return this.target;
	}
}
